/*
 * @Descripttion: 说明
 * @version: V1.0
 * @Author: GaoWei
 * @Date: 2021-04-25 12:11:55
 * @LastEditors: GW
 * @LastEditTime: 2021-12-10 14:32:43
 */
import { axios } from "../../utils/request";

const api = {
    List: "/in/inventory/pageList",
    Save: "/in/inventory/save",
    DELETE: "/in/inventory/delete",
    getList: "/in/inventory/getList",//搜索匹配物料

    filedUrl: "/in/inventory/getExcelFiled",//解析Excel导入字段
    downloadUrl: "/in/inventory/importTemplate",//下载导入数据模板
    importUrl: "/in/inventory/importData",//导入数据
    exportUrl: "/in/inventory/exportData",//导出数据

    importAreaUrl:'/so/areaCalculation/importData',//面积计算表导入
    importAreaPriceUrl:'/so/areaCalculation/importPrice',//面积计算表报价导入
    



};


/**
* 获取物料档案列表
*/
export function list(parameter) {
    return axios({
        url: api.List,
        method: "get",
        params: parameter,
        timeout: 500000,
    });
}


/**
 * 新增/修改物料档案
 * @param {*} data
 */
export function save(data) {
    return axios({
        url: api.Save,
        method: "post",
        data: data
    });
}

/**
 * 删除物料档案
 */
export function deleteInventory(data) {
    return axios({
        url: api.DELETE,
        method: "post",
        data: data
    });
}

/**
* 搜索匹配物料
*/
export function getList(parameter) {
    return axios({
        url: api.getList,
        method: "get",
        params: parameter,
    });
}

/**
 * 解析Excel导入字段
 */
export function getExportData(data) {
    return axios({
        url: api.filedUrl,
        method: "post",
        data: data
    });
}

/**
* 下载导入数据模板
*/
export function downloadDemo(parameter) {
    return axios({
        url: api.downloadUrl,
        method: "get",
        params: parameter,
        responseType: 'blob'
    });
}

/**
* 导出数据
*/
export function exportInventoryData(parameter) {
    return axios({
        url: api.exportUrl,
        method: "get",
        params: parameter,
        responseType: 'blob'
    });
}

/**
 * 导入数据
 */
export function importInventoryData(data) {
    return axios({
        url: api.importUrl,
        method: "post",
        data: data,
        headers: {
            "Content-Type": "multipart/form-data"
        },
        timeout: 5000000,
    });
}

//导入面积计算表
export function importAreaData(data) {
    return axios({
        url: api.importAreaUrl,
        method: "post",
        data: data,
        headers: {
            "Content-Type": "multipart/form-data"
        },
        timeout: 5000000,
    });
}

//面积计算表报价导入
export function importAreaPriceData(data) {
    return axios({
        url: api.importAreaPriceUrl,
        method: "post",
        data: data,
        headers: {
            "Content-Type": "multipart/form-data"
        },
        timeout: 5000000,
    });
}



